package edu.stthomas.seis752.model;

// default package
// Generated Apr 11, 2013 1:36:19 AM by Hibernate Tools 3.4.0.CR1

import java.util.Date;
import java.util.HashSet;
import java.util.Set;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import static javax.persistence.GenerationType.IDENTITY;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

/**
 * Media generated by hbm2java
 */
@Entity
@Table(name = "media", catalog = "jibster")
public class Media implements java.io.Serializable {

	private Long id;
	private MediaType mediaType;
	private User user;
	private String name;
	private String fileLocation;
	private String fileName;
	private Date createDate;
	private Set<User> users = new HashSet<User>(0);
	private Set<MediaTag> mediaTags = new HashSet<MediaTag>(0);
	private Set<Location> locations = new HashSet<Location>(0);

	public Media() {
	}

	public Media(MediaType mediaType, User user, String name,
			String fileLocation, String fileName, Date createDate) {
		this.mediaType = mediaType;
		this.user = user;
		this.name = name;
		this.fileLocation = fileLocation;
		this.fileName = fileName;
		this.createDate = createDate;
	}

	public Media(MediaType mediaType, User user, String name,
			String fileLocation, String fileName, Date createDate,
			Set<User> users, Set<MediaTag> mediaTags, Set<Location> locations) {
		this.mediaType = mediaType;
		this.user = user;
		this.name = name;
		this.fileLocation = fileLocation;
		this.fileName = fileName;
		this.createDate = createDate;
		this.users = users;
		this.mediaTags = mediaTags;
		this.locations = locations;
	}

	@Id
	@GeneratedValue(strategy = IDENTITY)
	@Column(name = "id", unique = true, nullable = false)
	public Long getId() {
		return this.id;
	}

	public void setId(Long id) {
		this.id = id;
	}

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "type", nullable = false)
	public MediaType getMediaType() {
		return this.mediaType;
	}

	public void setMediaType(MediaType mediaType) {
		this.mediaType = mediaType;
	}

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "owner_id", nullable = false)
	public User getUser() {
		return this.user;
	}

	public void setUser(User user) {
		this.user = user;
	}

	@Column(name = "name", nullable = false, length = 45)
	public String getName() {
		return this.name;
	}

	public void setName(String name) {
		this.name = name;
	}

	@Column(name = "file_location", nullable = false, length = 45)
	public String getFileLocation() {
		return this.fileLocation;
	}

	public void setFileLocation(String fileLocation) {
		this.fileLocation = fileLocation;
	}

	@Column(name = "file_name", nullable = false, length = 45)
	public String getFileName() {
		return this.fileName;
	}

	public void setFileName(String fileName) {
		this.fileName = fileName;
	}

	@Temporal(TemporalType.TIMESTAMP)
	@Column(name = "create_date", nullable = false, length = 0)
	public Date getCreateDate() {
		return this.createDate;
	}

	public void setCreateDate(Date createDate) {
		this.createDate = createDate;
	}

	@OneToMany(fetch = FetchType.LAZY, mappedBy = "profilePicture")
	public Set<User> getUsers() {
		return this.users;
	}

	public void setUsers(Set<User> users) {
		this.users = users;
	}

	@OneToMany(fetch = FetchType.LAZY, mappedBy = "media")
	public Set<MediaTag> getMediaTags() {
		return this.mediaTags;
	}

	public void setMediaTags(Set<MediaTag> mediaTags) {
		this.mediaTags = mediaTags;
	}

	@OneToMany(fetch = FetchType.LAZY, mappedBy = "media")
	public Set<Location> getLocations() {
		return this.locations;
	}

	public void setLocations(Set<Location> locations) {
		this.locations = locations;
	}

}
